package com.projectxxxxxxxxxx.ui;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.widget.TextView;

import com.projectxxxxxxxxxx.R;
import com.projectxxxxxxxxxx.info.Info;

public class TrafficActivity extends Activity {

	private final Handler mHandler = new Handler();
	private final long mStartRX = 0;
	private final long mStartTX = 0;

	//@TargetApi(8)
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.traffic_activity);
		// mStartRX = Long.parseLong(Info.TRAFFIC_RX.get().get(Info.INFO_TRAFFIC_RX));
		// mStartTX = Long.parseLong(Info.TRAFFIC_TX.get().get(Info.INFO_TRAFFIC_TX));
		mHandler.postDelayed(mRunnable, 1000);
	}
	
	private final Runnable mRunnable = new Runnable() {

		//@TargetApi(8)
		@Override
		public void run() {

			TextView RX = (TextView) findViewById(R.id.RX);
			TextView TX = (TextView) findViewById(R.id.TX);
			TextView RKX = (TextView) findViewById(R.id.RKX);
			TextView TKX = (TextView) findViewById(R.id.TKX);

			TextView TrafficLog = (TextView) findViewById(R.id.traffic_log);

			TrafficLog.setText(Info.NETWORK.get().get(Info.INFO_NETWORK_LOG));

			// long rxBytes = Long.parseLong((Info.TRAFFIC_RX.get().get(Info.INFO_TRAFFIC_RX))) - mStartRX;
			// RX.setText(Long.toString(rxBytes));
			//
			// long txBytes = Long.parseLong((Info.TRAFFIC_TX.get().get(Info.INFO_TRAFFIC_TX))) - mStartTX;
			// TX.setText(Long.toString(txBytes));


			RKX.setText(Long.toString(0 / 1024));
			TKX.setText(Long.toString(0 / 1024));

			mHandler.postDelayed(mRunnable, 1000);
		}
	};
}
